﻿/*
 * Pomoho UI
 *
 * Copyright (c) 2007 sorrycc@gmail.com (pomoho.com)
 * Date: 2007-10-29
 */

(function ($){
	String.prototype.cut=function (length){
		var cl=0;
		var str=this;
		var length=parseInt(length);
		if(this.length>length){
			for(var i=0,l=str.length;i<l;i++){
				var letter=str.charAt(i);
				if(!/[u00-uFF]/.test(letter)){
					cl+=2;
					
				}else {
					cl++;
					
				}if(cl>length){
					return str.substr(0,i==0?i=1:i)+'...';
					
				}
			}
		}return str;
		
	};
	var Pui=window.Pui={
		init:function (){
			baseurl='http://www.pomoho.com/do/';
			document.write('<div style="overflow:hidden;height:0;"><img src="http://static.pomoho.com/themes/site/200708/images/public/msg_btn.gif" /><img src="http://static.pomoho.com/themes/site/200708/images/public/msg_close.gif" /><img src="http://static.pomoho.com/themes/site/200708/images/public/msg_page.gif" /></div>');
			_user={
				uid:0,nick:'',spacename:'',newmsg:0
			};
			_is_login=false;
			var n=this.cookie('LoginInfo');
			if(n){
				var arr=n.split('$***$');
				_user={
					uid:arr[0].replace('LoginInfo=',''),nick:arr[1],spacename:arr[2],newmsg:0
				};
				_is_login=true;
				if(Pui.cookie('NewMsgCount'+_user.uid)){
					_user.newmsg=Pui.cookie('NewMsgCount'+_user.uid);
					msg='unread';
					
				}else {
					msg=(_user.newmsg==0)?'empty':'unread';
					
				}
			}
		},initUser:function (){
			this.init();
			
		},initManage:function (id){
			if(typeof(id)!='undefined'&&_user.uid!=parseInt(id))document.write('<style type="text/css">.is_login { display:none; }</style>');
			
		},cookie:function (name,value,options){
			if(typeof(value)!='undefined'){
				options=options||{
					
				};
				if(value===null){
					value='';
					options.expires=-1;
					
				}var expires='';
				if(options.expires&&(typeof(options.expires)=='number'||options.expires.toUTCString)){
					var date;
					if(typeof(options.expires)=='number'){
						date=new Date();
						date.setTime(date.getTime()+(options.expires*24*60*60*1000));
						
					}else {
						date=options.expires;
						
					}expires='; expires='+date.toUTCString();
					
				}var path=options.path?'; path='+options.path:'';
				var domain=options.domain?'; domain='+options.domain:'';
				var secure=options.secure?'; secure':'';
				document.cookie=[name,'=',escape(value),expires,path,domain,secure].join('');
				
			}else {
				var cookieValue=null;
				if(document.cookie&&document.cookie!=''){
					var cookies=document.cookie.split(';');
					for(var i=0;i<cookies.length;i++){
						var cookie=jQuery.trim(cookies[i]);
						if(cookie.substring(0,name.length+1)==(name+'=')){
							cookieValue=unescape(cookie.substring(name.length+1));
							break;
							
						}
					}
				}return cookieValue;
				
			}
		},loadScript:function (url,options){
			var setting={
				random:true
			};
			if(options){
				$.extend(setting,options);
				
			}var f=document.createElement('script');
			f.type='text/javascript';
			var d=new Date();
			if(setting.random){
				if(url.match(/.*\?./)){
					url=url+'&random='+d.getTime()+parseInt(Math.random()*10000);
					
				}else {
					url=url+'?random='+d.getTime()+parseInt(Math.random()*10000);
					
				}
			}f.src=url;
			$('head')[0].appendChild(f);
			
		},callback:function (msg){
			alert(msg);
			
		},wFlash:function (options){
			var setting={
				url:'',w:0,h:0
			};
			if(options){
				$.extend(setting,options);
				
			}var s='';
			s+='';
			s+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+setting.w+'" height="'+setting.h+'">';
			s+=' <param name="movie" value="'+setting.url+'" />';
			s+=' <param name="quality" value="high" />';
			s+=' <param name="allowScriptAccess" value="always" />';
			s+=' <param name="wmode" value="transparent" />';
			s+=' <embed wmode="transparent" src="'+setting.url+'" quality="high" allowScriptAccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+setting.w+'" height="'+setting.h+'"></embed>';
			s+='</object>';
			document.write(s);
			
		},ui:function (){
			return {
				logDiag:function (sType,sTarget,sUrl){//全局通用登陆框。sType:本地local,新窗new; sTarget:目标URL; sUrl:Ajax接口地址
					if(_is_login){
						if(sType == 'new'){
							window.open(sTarget);
						}else{
							window.location.href = sTarget;
						}
					}else{
						Pui.header_v2.loginfo(sType,sTarget,sUrl);
					}
					
				},logDiagAjax:function (userName,pwd,sType,sTarget,sUrl){
					$.ajax({
						url:sUrl,dataType:"xmlDocument",type:"post",data:"action=http://www.pomoho.com/ui/logindo.aspx&form_name="+userName+"&form_password="+pwd+"&type=gamelogin&random="+Math.random(),error:function (){
							alert('可能网络问题,登录失败,请重试');
							
						},success:function (result){
							var userlog=eval(result);
							switch(parseInt(userlog[0].stat)){
								case -1:alert("登录帐号不存在");
								break;
								case -2:alert("用户名或者密码错误,请重试");
								break;
								case 1:Pui.header_v2.cookie('UserInfo',userlog[1].UserInfo,{
									path:'/',domain:'.pomoho.com',expires:1/6
								});
								Pui.header_v2.cookie('LoginInfo',userlog[2].LoginInfo,{
									path:'/',domain:'.pomoho.com',expires:1/6
								});
								Pui.header_v2.init();
								if(String($('body').attr('id'))=='B-Upload-1'&&(n==true)&&(typeof(flag)=='undefined'||flag==null)){
									Pui.upload.unite('GoTo2');
									start_upload($('#file1').val(),$('#uploadForm_Title').val());
									return 
								}if(sType=='local'){
									window.location.href=sTarget;
									
								}else if(sType=='new'){
									Pui.header_v2.closeDiv();
									window.open(sTarget);
									
								}if(typeof(flag)=='undefined'||flag==null)Pui.header_v2.closeDiv();
								break;
								default:alert("系统错误,请重试，错误代码："+userlog[1].ErrMsg);
								
							}
						}
					});
					
				},copy:function (text,msg){
					if($.browser.msie){
						window.clipboardData.setData("Text",text);
						
					}else {
						if(!document.getElementById('flashcopier')){
							$('<div id="flashcopier"></div>').appendTo('body');
							
						}$('#flashcopier').html('<embed src="http://static.pomoho.com/scriptures/clipboard.swf" FlashVars="clipboard='+text+'" width="0" height="0" style="position:absolute; top:-2000px;" type="application/x-shockwave-flash"></embed>');
						
					}if(msg){
						alert(msg);
						
					}
				},bookmark:function (title,url){
					if($.browser.msie){
						window.external.AddFavorite(url,title);
						
					}else if($.browser.mozilla){
						window.sidebar.addPanel(title,url,'');
						
					}
				},
				setHome:function(url){
			        try{
		                document.body.style.behavior='url(#default#homepage)';
		                document.body.setHomePage(url);
			        }
			        catch(e){
		                if(window.netscape) {
	                        try{
	                            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
								var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
								prefs.setCharPref('browser.startup.homepage','http://www.pomoho.com');
	                        }
	                        catch(e) { 
	                            alert("不好意思，此操作被浏览器拒绝……\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'\n或者直接在选项中设置首页。多谢支持爆米花的产品。");
	                        }
		                 }
			        }
				},
				gettime:function (){
					var time=new Date();
					var t_year=($.browser.msie)?time.getYear():String(time).split(" ")[3];
					var t_time=($.browser.msie)?String(time).split(" ")[3].substr(0,5):String(time).split(" ")[4].substr(0,5);
					var f_time=t_year+"-"+parseInt(time.getMonth()+1)+"-"+time.getDate()+" "+t_time;
					return f_time;
					
				},setServerTime:function (time){
					_servertime=time;
					
				},loadServerTime:function (){
					Pui.loadScript("http://www.pomoho.com/do/time/echo_second.aspx");
					
				}
			};
			
		}(),user:{
			initUserInfo:function (){
				this.initFlower();
				
			},initFlower:function (){
				$('#UserInfo .s5').hover(function (){
					showflower_timer=setTimeout('Pui.user.showFlower()',300);
					
				},function (){
					clearTimeout(showflower_timer);
					flower_timer=setTimeout('$("#Flower").fadeOut()',300);
					
				}).click(function (){
					this.blur();
					return false;
					
				});
				if(String(window.location).match(/http:\/\/home./)){
					this.initChat();
					
				}
			},showFlower:function (){
				if(String(window.location).match(/http:\/\/home./)){
					var owner_id=_space_user.uid;
					
				}else if(document.getElementById('UserInfo')){
					var owner_id=userid;
					
				}if(!document.getElementById('Flower')){
					$('<div id="Flower" style="display:none;color:black;"><strong>移动手机用户</strong>编辑短信 <b style="color:red;">8878'+owner_id+'</b> 发送到 <b style="color:red;">10669501</b> 支持你喜欢的主播，送上你的鲜花问候，即刻获得主播个人美图一张和主播个性留言喔。</div>').appendTo('#UserInfo .mUser').fadeIn();
					$('#Flower').hover(function (){
						clearTimeout(flower_timer);
						
					},function (){
						flower_timer=setTimeout('$("#Flower").fadeOut()',300);
						
					});
					
				}else {
					clearTimeout(flower_timer);
					$('#Flower').fadeIn();
					
				}
			},initChat:function (){
				$('#UserInfo .s8').hover(function (){
					chat_timer=setTimeout('Pui.user.showChat()',300);
					
				},function (){
					clearTimeout(chat_timer);
					chat_timer=setTimeout('$("#Chat").fadeOut()',300);
					
				}).click(function (){
					this.blur();
					return false;
					
				});
				
			},showChat:function (){
				if(!document.getElementById('Chat')){
					$('<div id="Chat" style="display:none;color:black;">移动用户拨打 <b style="color:red;">1259067017</b> ,联通手机用户拨打 <b style="color:red;">101762092</b> 。与偶像真人零距离接触，真实体验主播们的更多生活趣事，都是小秘密噢！</div>').appendTo('#UserInfo .mUser').fadeIn();
					$('#Chat').hover(function (){
						clearTimeout(chat_timer);
						
					},function (){
						chat_timer=setTimeout('$("#Chat").fadeOut()',300);
						
					});
					
				}else {
					clearTimeout(chat_timer);
					$('#Chat').fadeIn();
					
				}
			},addfriend:function (userid){
				Pui.loadScript(baseurl+"/space/personjs.aspx?dotype=1&userid="+userid+"");
				
			},addfans:function (userid){
				Pui.loadScript(baseurl+"/space/personjs.aspx?dotype=2&userid="+userid+"");
				
			},subscribe:function (userid){
				Pui.loadScript(baseurl+"/space/personjs.aspx?dotype=3&userid="+userid+"");
				
			},cancelsubs:function (a,b,c){
				Pui.loadScript(baseurl+"/space/personjs.aspx?dotype=6&userid="+b+"&typeid="+a+"&objid="+c+"");
				
			},addmessage:function (userid,obj){
				
			},delguestbook:function (iguestbook){
				if(window.confirm("确认要删除吗?")){
					Pui.loadScript(baseurl+"/space/personjs.aspx?dotype=5&blogid="+iguestbook+"&userid="+_space_user.uid);
					
				}
			},delnotebook:function (notebookid){
				if(window.confirm("确认要删除吗?")){
					Pui.loadScript(baseurl+"/space/mydoingajax.aspx?opreatetype=del&notebookid="+notebookid+"&userid="+_space_user.uid);
					
				}
			},addnotebook:function (){
				
			},addContent:function (){
				if(!$("#sendMsg").length){
					$('#Prompt h3').after('<p id="sendMsg" class="p1"></p>');
					$('#btnlog').after('<input class="back" type="button" value="返回当前页面" /><input class="space" type="button" value="去我的个人空间" />');
					$("#Prompt .back").bind("click",Pui.newSH.closeDiv);
					$("#Prompt .space").click(function (){
						window.open('http://home.pomoho.com/'+_user.spaceurl+'.shtml');
						
					});
					
				}
			},showPromptDiv:function (flvid,flvtitle){
				if($("#Prompt").length==0)
					Pui.newSH.showLogDiv();
				flv={
					ids:flvid,title:flvtitle
				};
				this.addContent();
				if(_is_login){
					Pui.user.haveFriend();
					
				}else {
					flag=1;
					Pui.newSH.loginfo();
					//Pui.user.haveFriend();
					
				}
			},haveFriend:function (){
				$.ajax({
					url:"http://"+window.location.hostname+"/do/interfaces/sendajaxreq.aspx",dataType:"xmlDocument",type:"POST",data:"action=http://www.pomoho.com/do/interfaces/sendtofriends.aspx&imdbid="+flv.ids+"&type=sendfriends&userid="+_user.uid+"&random="+Math.random(),error:function (){
						alert('读取文件错误');
						Pui.newSH.closeDiv();
						
					},success:function (result){
						var userlog=eval(result);
						switch(parseInt(userlog[0].stat)){
							case 0:Pui.user.sendNoFriend();
							break;
							case 1:Pui.user.sendSuccess();
							break;
							default:Pui.user.sendErr(userlog[1].ErrMsg);
							break;
							
						};
						
					}
				});
				
			},sendSuccess:function (){
				$("#Prompt .k")[0].className="k suc";
				$("#Prompt").show();
				var gameUrl="http://video.pomoho.com/ent/"+flv.ids;
				$("#sendMsg").html("视频&#8220;<a href="+gameUrl+" ><u>"+flv.title+"</u></a>&#8221;已成功推荐给您的米花好友,他们将在下次登录的时候,收到您的推荐信息.");
				flv=null;
				
			},sendNoFriend:function (){
				$("#Prompt .k")[0].className="k err";
				$("#Prompt").show();
				$("#sendMsg").html("非常抱歉。您在爆米花还没有好友，这个好像不对哦:),人在江湖走，哪能没朋友呢，赶紧邀请你的好友加入爆米花吧.");
				flv=null;
				
			},sendErr:function (errcode){
				$("#Prompt .k")[0].className="k err";
				$("#Prompt").show();
				$("#sendMsg").html("可能网络问题,推荐失败,请重试.错误代码:"+errcode);
				flv=null;
				
			}
		},pos:{
			elementTop:function (element){
				var y=0;
				for(var e=element;e;e=e.offsetParent)y+=e.offsetTop;for(e=element.parentNode;e&&e!=document.body;e=e.parentNode)if(e.scrollTop)y-=e.scrollTop;return y;
			}
		},ReUrl:function (url,ob){
			if(ob)_thisname=ob.innerHTML;
			if(_is_login){
				if(ob&&_thisname=="我的空间"){
					url="http://home.pomoho.com/"+_user.spaceurl+".shtml";
					$(ob).attr("target","_blank");
					$(ob).attr("href",url);
					_thisname=null;
					return ;
					
				}window.open(url);
				
			}else {
				flag=5;
				pathUrl=url;
				Pui.newSH.loginfo();
				
			}
		}
	};
	Pui.initUser();
	Pui.msg={
		init:function (url){
			this.currPage=1;
			this.totalPage=0;
			this.allPage=0;
			this.xmlPage=0;
			this.url=url;
			if(_is_login){
				Pui.loadScript(url);
				
			}
		},jsonMessage:function (json){
			this.currPage=1;
			if(!json['show'])return ;
			this.totalPage=json['totalPage'];
			if(this.totalPage!=0){
				if($('#TT')[0]){
					$('#TT .login img').attr('src','http://static.pomoho.com/themes/site/200708/images/public/msg_unread.png');
					$('#TT .login span').text(this.totalPage);
					
				}else if($('#T')[0]){
					$('#T .msg').html(' <img src="http://static.pomoho.com/themes/site/200708/images/public/msg_unread.png" />('+this.totalPage+')');
					
				}
			}this.allPage=json['allPage'];
			this.xmlPage=json['xmlpage'];
			var content='<div class="content">';
			for(var i=0;i<json['items'].length;i++){
				var item=json['items'][i];
				if(i==0){
					content+='<div id="msg_'+item['id']+'" class="'+item['type']+'">'+item['content']+'</div>';
					
				}else {
					content+='<div id="msg_'+item['id']+'" class="'+item['type']+'" style="display:none">'+item['content']+'</div>';
					
				}
			}content+='</div>';
			if(!!document.getElementById('Message'))$('#Message').remove();
			$('<div id="Message"></div>').html(content).prependTo('body');
			$('<div class="handle"><span class="close"><a href="javascript:Pui.msg.close()" title="关闭窗口">关闭</a></span></div>').appendTo('#Message');
			if(this.totalPage!=1){
				$('<span class="roll"><a href="javascript:Pui.msg.next();" title="下一条" class="next">下一条</a></span>').prependTo('#Message .handle');
				$('<span class="count">'+this.currPage+'/'+this.totalPage+'</span>').prependTo('#Message .handle');
				
			}else {
				$('<span class="count" style="margin-right:6px;">'+this.currPage+'/'+this.totalPage+'</span>').prependTo('#Message .handle');
				
			}if(json['more']==1){
				$('<span class="more" style="margin-right:6px;margin-top:4px;"><a href="http://www.pomoho.com/">更多</a></span>').prependTo('#Message .handle');
				
			}
		},prev:function (e){
			this.currPage--;
			this.show();
			
		},next:function (e){
			this.currPage++;
			this.show();
			
		},show:function (){
			if(this.allPage>50&&this.currPage==51+this.xmlPage){
				window.location="http://www.pomoho.com/";
				
			}$('#Message .content div').hide().eq(this.currPage-1).show();
			$('#Message .count').html(this.currPage+'/'+this.totalPage);
			if(this.currPage==1){
				$('#Message .roll').html('<span class="roll"><a href="javascript:Pui.msg.next();" title="下一条" class="next">下一条</a></span>');
				
			}else if(this.currPage>1&&this.currPage<this.totalPage){
				$('#Message .roll').html('<span class="roll"><a href="javascript:Pui.msg.prev();" title="上一条" class="prev">上一条</a><a href="javascript:Pui.msg.next();" title="下一条" class="next">下一条</a></span>');
				
			}else if(this.currPage==this.totalPage){
				$('#Message .roll').html('<span class="roll"><a href="javascript:Pui.msg.prev();" title="上一条" class="prev">上一条</a></span>');
				
			}
		},close:function (){
			$('#Message').slideUp();
			var currTime=new Date().getTime();
			Pui.cookie('NewMsgCount'+_user.uid,this.totalPage,{
				expires:1,domain:'pomoho.com'
			});
			Pui.loadScript('http://notice.pomoho.com/closemessage.aspx?userid='+_user.uid);
			
		},readMessageHandler:function (handler){
			if(handler){
				if(this.totalPage==1){
					$('#Message').fadeOut('slow');
					
				}else {
					if(typeof(this.url)!='undefined')Pui.loadScript(this.url);
					
				}
			}
		},friendadd:function (type,friendID,messageID){
			Pui.loadScript("http://notice.pomoho.com/MessagEven.aspx?type="+type+"&receiveID="+friendID+"&messageID="+messageID);
			
		},InvertCombo:function (type,friendID,messageID,ComboID){
			Pui.loadScript("http://notice.pomoho.com/MessagEven.aspx?type="+type+"&receiveID="+friendID+"&messageID="+messageID+"&ComboID="+ComboID);
			
		}
	};
	Pui.hs={
		init:function (){
			this.initStyle();
			this.initContent();
			
		},initStyle:function (){
			var s='';
			s+='<style type="text/css">';
			s+='#HS { position:fixed; _position:absolute; z-index:9; left:0; top:0; _clear:both; _top:expression(documentElement.scrollTop); width:100%; height:30px; background:url(http://static.pomoho.com/themes/site/200708/images/public/h_s.png); }';
			s+='#LogoS img { display:block; padding:0 0 0 11px; }';
			s+='#TT { position:absolute; right:194px; top:2px; }';
			s+='#TT li { float:left; margin-left:8px; color:#666; font:12px/30px arial; }';
			s+='#TT .upload { padding-left:22px; background:url(http://static.pomoho.com/themes/site/200708/images/public/h_s_upload.png) no-repeat 0 40%; }';
			s+='#TT .record { padding-left:22px; background:url(http://static.pomoho.com/themes/site/200708/images/public/h_s_record.png) no-repeat 0 40%; }';
			s+='#TT li a { text-decoration:none; font-family:"宋体",Calibri,arial,helvetica,sans-serif; }';
			s+='#TT li a:hover { text-decoration:underline; }';
			s+='#TT li a span { cursor:pointer; }';
			s+='#TT .login a { margin:0 4px; }';
			s+='#TT .login a img { margin-top:9px; }';
			s+='#SS { position:absolute; right:12px; top:2px; }';
			s+='#SS .s_txt { width:98px; height:16px; border:1px solid #7b9ebc; color:#999; padding:2px 2px 0 2px; margin-right:6px; }';
			s+='#SS .s_btn { width:58px; height:20px; border:0; background:url(http://static.pomoho.com/themes/site/200708/images/public/hs_btn.png); color:white; font:bold 12px arial; cursor:pointer; }';
			s+='#MS { display:none; position:fixed; _position:absolute; z-index:10; _clear:both; left:50%; top:33px; _top:expression(documentElement.scrollTop+33); margin-left:-500px; width:1000px; background:white; }';
			s+='#MS .ms_d { height:24px; font:12px/24px arial; color:#d0d0d0; }';
			s+='#MS strong { margin-right:6px; color:#f06; }';
			s+='#MS strong span { margin-left:6px; font-weight:normal; }';
			s+='#MS .ms_d a { margin:0 7px; }';
			s+='#TS{display:none;position:absolute;right:5px;top:25px;width:267px;padding-left:2px;padding-top:10px; _width:265px; _padding-left:4px; height:40px; background:url(http://static.pomoho.com/themes/site/200708/images/public/ts.png) no-repeat; line-height:18px;}';
			s+='#TS a{color:#333;}';
			s+='</style>';
			document.write(s);
			
		},initContent:function (){
			var s='',a='',logo='logo_s',home='http://www.pomoho.com/';
			s+='<a href="'+home+'" id="LogoS" target="_blank"><img src="http://static.pomoho.com/themes/site/200708/images/public/'+logo+'.png" alt="爆米花视频" /></a>';
			s+='<div id="TT"><ul>';
			s+='  <li><a href="http://www.pomoho.com/" target="_blank">首页</a></li>';
			s+='  <li><a href="http://mm.pomoho.com/" target="_blank">美女</a></li>';
			s+='  <li><a href="http://baby.pomoho.com" target="_blank">Baby</a></li>';
			s+='  <li><a href="http://k.pomoho.com/" target="_blank">K歌</a></li>';
			s+='  <li><a href="http://post.pomoho.com/" target="_blank">贴吧</a></li>';
			s+='  <li><a href="http://m.pomoho.com/record/diy/index.aspx" target="_blank">DIY彩视</a></li>';
			s+='  <li class="all"><a href="">全部导航</a></li>';
			s+='  <li class="upload"><a href="http://www.pomoho.com/upload/" target="_blank">上传节目</a></li>';
			s+='  <li class="record"><a href="http://www.pomoho.com/record/" target="_blank">在线录制</a></li>';
			if(!_is_login){
				s+='<li class="guest"><a href="http://www.pomoho.com/ui/login.aspx" target="_blank">注册登录</a></li>';
				
			}else {
				if(Pui.cookie('NewMsgCount')){
					NewMsgs=Pui.cookie('NewMsgCount');
					msg='unread';
					
				}else {
					NewMsgs=_user.newmsg;
					msg=(_user.newmsg==0)?'empty':'unread';
					
				}s+='<li class="login">你好，<a href="http://www.pomoho.com/ui/blogadmin.aspx?_type=preview" target="_blank">'+_user.nick+'</a> | <a href="http://www.pomoho.com/manage/messagelist.aspx" target="_blank"><img src="http://static.pomoho.com/themes/site/200708/images/public/msg_'+msg+'.png" /> (<span>'+NewMsgs+'</span>)</a> | <a href="http://www.pomoho.com/manage/index.aspx" class="manage">管理</a><div id="TS"><a href="http://www.pomoho.com/manage/managevideo.aspx" target="_blank">我的视频</a> | <a href="http://www.pomoho.com/manage/managevideo.aspx?type=favs" target="_blank">我的收藏</a> | <a href="#" target="_blank">设为首页</a> | <a href="#">加入收藏</a><br><a href="http://www.pomoho.com/manage/subscribevblog.aspx" target="_blank">我的订阅</a> | <a href="http://www.pomoho.com/ui/logout.aspx">退出</a> | <a href="http://www.pomoho.com/manage/index.aspx" target="_blank">更多……</a></div></li>';
				
			}s+='</ul></div>';
			s+='<div id="SS"><form action="http://search.pomoho.com/videosearch.aspx?" target="_blank"><input type="text" value="找节目看？" class="s_txt" accesskey="s" name="_keyword" /><input type="submit" value="搜视频" class="s_btn" /></form></div>';
			if(/(home\.pomoho\.com)|album/.test(String(window.location)) || /SpaceAlbum/.test($('body').attr('id')) ){
				a+='<div id="MenuS"><ul class="m1">';
			}else {
				a+='<div id="Menu"><ul class="m1">';
				
			}a+='<li class="s1"><a href="http://mm.pomoho.com" target="_blank">美女</a></li>';
			a+='<li class="s2"><a href="http://baby.pomoho.com" target="_blank">Baby</a></li>';
			a+='<li class="s3"><a href="http://www.pomoho.com/star" target="_blank">明星</a></li>';
			a+='<li class="s4"><a href="http://www.pomoho.com/campus" target="_blank">校园</a></li>';
			a+='<li class="s5"><a href="http://www.pomoho.com/pet" target="_blank">宠物</a></li>';
			a+='<li class="s6"><a href="http://www.pomoho.com/funny" target="_blank">搞笑</a></li>';
			a+='<li class="s7"><a href="http://www.pomoho.com/news" target="_blank">热点</a></li>';
			a+='<li class="s8"><a href="http://www.pomoho.com/finance" target="_blank">财经</a></li>';
			a+='<li class="s9"><a href="http://www.pomoho.com/travel" target="_blank">旅行</a></li>';
			a+='<li class="s10"><a href="http://www.pomoho.com/auto" target="_blank">汽车</a></li>';
			a+='<li class="s2"><a href="http://www.pomoho.com/game" title="" target="_blank">游戏</a></li>';
			a+='<li class="s11"><a href="http://webgame.pomoho.com" title="" target="_blank">网页游戏</a></li>';
			a+='</ul></div>';
			$('#HS').html(s).after('<div id="MS">'+a+'</div>');
			$('#TT .all a').hover(function (){
				$('#MS').fadeIn();
			},function (){
				
			});
			$('#MS').hover(function (){
				
			},function (){
				$('#MS').fadeOut();
				
			}).find('p a').click(function (){
				$('#MS').fadeOut();
				return false;
				
			});
			timer_tt_manage=null;
			$('#TT .manage').hover(function (){
				clearTimeout(timer_tt_manage);
				$('#TS').fadeIn();
				
			},function (){
				timer_tt_manage=setTimeout("$('#TS').fadeOut()",500);
				
			}).click(function (){
				return false;
				
			});
			$('#TS').hover(function (){
				clearTimeout(timer_tt_manage);
				
			},function (){
				timer_tt_manage=setTimeout("$('#TS').fadeOut()",500);
				
			});
			$('#SS .s_txt').click(function (){
				if($(this).val()=='找节目看？')$(this).val('');
				else if($(this).val()=='')$(this).val('找节目看？');
				
			}).blur(function (){
				if($(this).val()=='找节目看？')$(this).val('');
				else if($(this).val()=='')$(this).val('找节目看？');
				
			});
			
		}
	};
	Pui.fs={
		init:function (options){
			if(options){
				$.extend(setting,options);
				
			}this.initStyle();
			this.initContent();
			document.write("<div style='display:none'>");
			try{
				this.advCall();
				
			}catch(e){
				
			}document.write("</div>");
			document.write('<script type="text/javascript" src="http://static.pomoho.com/static/scriptures/bottom.js"></scr'+'ipt>');
			
		},initStyle:function (){
			var s='';
			s+='<style type="text/css">';
			s+='#FS { clear:both; text-align:center; width:1000px; margin:0 auto; font-family:arial; }';
			s+='#FS #Links { text-align:center; padding:16px 0 6px; }';
			s+='#FS #Links a { margin:0 3px; color:#333; }';
			s+='#FS #Copyright, #FS #Copyright a { color:#666; }';
			if(typeof($('body').attr('class'))!='undefined'){
				if($('body').attr('class').indexOf('b-dark')!=-1){
					s+='#FS #Links a { color:#ccc; }';
					s+='#FS #Copyright, #FS #Copyright a { color:#999; }';
					
				}
			}s+='</style>';
			document.write(s);
			
		},initContent:function (){
			var s='';
			s+='<div id="FS">';
			s+='<div id="Links">';
			s+='  <a href="http://static.pomoho.com/doc/about.shtml" target="_blank">关于爆米花</a>';
			s+='  <a href="http://static.pomoho.com/doc/law.shtml" target="_blank">法律声明</a>';
			s+='  <a href="http://static.pomoho.com/doc/copyright.shtml" target="_blank">著作权保护</a>';
			s+='  <a href="http://static.pomoho.com/doc/terms.shtml" target="_blank">用户协议</a>';
			s+='  <a href="http://static.pomoho.com/doc/ads.shtml" target="_blank">广告服务</a>';
			s+='  <a href="http://static.pomoho.com/doc/jobs.shtml" target="_blank">诚聘英才</a>';
			s+='  <a href="http://static.pomoho.com/doc/help.shtml" target="_blank">使用帮助</a>';
			s+='  <a href="http://static.pomoho.com/doc/friends.shtml" target="_blank">友情链接</a>';
			s+='  <a href="http://www.pomoho.com/sitemap/" target="_blank">网站地图</a>';
			s+='</div>';
			s+='<div id="Copyright">';
			s+='  &copy; 2005-2008 Pomoho.com 京ICP：040263';
			s+='</div>';
			s+='</div>';
			$('body').append(s);
			
		},advCall:function (){
			document.write('<scr'+'ipt type="text/javascript" src="http://static.pomoho.com/static/scriptures/analysisload.js"></sc'+'ript>');
			document.write('<scr'+'ipt type="text/javascript" src="http://static.pomoho.com/static/scriptures/analysiscall.js"></sc'+'ript>');
			document.write('<scr'+'ipt type="text/javascript" src="http://union.pomoho.com/callback.aspx"></sc'+'ript>');
			document.write('<nos'+'cript><a href="http://union.pomoho.com/" target="_blank"><img alt="&#x6211;&#x8981;&#x5566;&#x514D;&#x8D39;&#x7EDF;&#x8BA1;" src="http://union.pomoho.com/callback.aspx" style="border:none" /></a></nos'+'cript>');
			
		}
	};
	Pui.showData=function (json){
		var path={
			user:['.t_login span','.c_friend span','.c_fans span','.c_view span','.c_video span','.c_flower span'],video:['.c_view span','.c_review span','.c_bookmark span'],special:['.c_video span','.c_view span','.c_rss span','.t_update span','.t_length span'],combo:['.d_video span','.d_collect span','.d_topic span','.d_menber span','.d_album span','.d_mvvideo span'],combo_handle:['.c_num','.c_num_m']
		};
		var path_n={
			user:['.d_time_login span','.d_friend span','.d_fans span','.d_view span','.d_video span','.d_flower span'],video:['.d_view span','.d_review span','.d_bookmark span'],special:['.d_video span','.d_view span','.d_rss span','.d_update span','.d_length span'],combo:['.d_video span','.d_collect span','.d_topic span','.d_menber span','.d_album span','.d_mvvideo span']
		};
		$('.t_login').html('最近登录：<span></span>');
		for(var i=0,length=json.length;i<length;i++){
			var type=json[i].type,id=json[i].id,data=json[i].data,wrap='#'+type+'_'+id;
			if(!$(wrap)[0]) continue;
			for(j=0;j<path[type].length;j++){
				if($(wrap+' '+path[type][j])[0]){
					$(wrap+' '+path[type][j])[0].innerHTML=data[j];
				}else if($(wrap+' '+path_n[type][j])[0]){
					$(wrap+' '+path_n[type][j])[0].innerHTML=data[j];
					
				}
			}
		}
	};
	$.fn.dropMenu=function (){
		return this.find('li').not(this.find('li li')).each(function (){
			var m_timer_li=null,m_timer_ul=null;
			var isdown=false;
			var tmpLI=$(this),tmpUL=tmpLI.find('ul');
			tmpLI.hover(function (){
				clearTimeout(m_timer_ul);
				m_timer_li=setTimeout(function (){
					tmpLI.parent().find('.hover').removeClass('hover');
					isdown=true;
					tmpLI.addClass('hover');
					
				},150);
				
			},function (){
				clearTimeout(m_timer_li);
				clearTimeout(m_timer_ul);
				m_timer_ul=setTimeout(function (){
					isdown=false;
					tmpLI.removeClass('hover')
				},500);
				
			});
			tmpUL.hover(function (){
				clearTimeout(m_timer_ul);
				
			},function (){
				m_timer_ul=setTimeout(function (){
					isdown=false;
					tmpLI.removeClass('hover')
				},500);
				
			});
			
		});
		
	};
	$.fn.toggleShow=function (options){
		var o={
			el:'.mUser',cls:'current'
		};
		if(options)$.extend(o,options);
		return $(this).each(function (){
			$(this).find(o.el).mouseover(function (){
				if($(this).attr('class').indexOf(o.cls)!=-1)return ;
				$(this).parent().find('.'+o.cls).removeClass(o.cls);
				$(this).addClass(o.cls);
				
			});
			
		});
		
	};
	$.fn.tab=function (){
		var t_timer=null;
		var delay=150;
		return this.each(function (){
			$(this).find("dt").hover(function (){
				t_current=this;
				clearTimeout(t_timer);
				t_timer=setTimeout("$.changeTab(t_current)",delay);
				
			},function (){
				clearTimeout(t_timer);
				
			});
			
		});
		
	};
	$.fn.imageRoller=function (options){
		var setting={
			count:5,width:800,inner:'li',outer:'ul',left:'.left',right:'.right',cycle:true
		};
		if(options){
			$.extend(setting,options);
			
		}return $(this).each(function (){
			var curr=1,total=Math.ceil($(this).find(setting.inner).length/setting.count),outer=$(this).find(setting.outer);
			$(this).find(setting.left).click(function (){
				if(curr!=1){
					outer.animate({
						left:-(setting.width*(curr-2))
					},1000);
					curr--;
					
				}else if(setting.cycle&&curr==1){
					outer.animate({
						left:-(setting.width*(total-1))
					},1000);
					curr=total;
					
				}this.blur();
				return false;
				
			});
			$(this).find(setting.right).click(function (){
				if(total!=curr){
					outer.animate({
						left:-(setting.width*curr)
					},1000);
					curr++;
					
				}else if(setting.cycle&&curr==total){
					outer.animate({
						left:0
					},1000);
					curr=1;
					
				}this.blur();
				return false;
				
			});
			
		});
		
	};
	jQuery.extend({
		mousepos:function (e){
			var d=document.documentElement,b=document.body;
			return [e.pageX||(d.scrollLeft||b.scrollLeft)+e.clientX,e.pageY||(d.scrollTop||b.scrollTop)+e.clientY];
			
		},stopBubble:function (e){
			e?e.stopPropagation():window.event.cancelBubble=true;
			
		},changeTab:function (e){
			$(e).parent().find(".ac").toggleClass("ac").next().toggle();
			$(e).blur().toggleClass("ac").next().toggle();
			
		}
	});
	$(function (){
		var urlString=window.location.toString ().toLowerCase();
		if(urlString.indexOf("home.pomoho.com")!=-1)
		Pui.msg.init('http://notice.pomoho.com/loadmessage.aspx?userid='+_user.uid);
		
	});
	
})(jQuery);